<template>
  <div>
    <!-- 订单状态 -->
    <section class="c-ph24 bgTop theme-bg c-hh100 c-flex-row c-aligni-center c-justify-sb c-fc-white">
      <div class="c-flex-grow1">
        <span class="c-fs28">{{ ORDER_STATUS_MAP[orderStatus] }}</span>
        <span v-if="subOrderStatusText" class="c-fs28">({{ subOrderStatusText }})</span>
      </div>
      <span class="c-fs24">{{ getformTimeTxt }}</span>
    </section>
    <!-- 物流信息 -->
    <section class="c-bg-white c-flex-row c-aligni-center c-ph24 c-pv30 c-mb12" @click="goAddressDetail" v-if="isShowExpressInfo">
      <i class="iconfont theme-fc c-fs56">&#xe641;</i>
      <div v-if="noNeedExpress" class="c-fs24 c-lh34 c-fc-xblack c-ml20">无需物流</div>
      <div v-if="hasTwoExprress" class="c-ml20 c-fs22 c-lh28 c-fc-sblack c-flex-row c-aligni-center">该订单已拆分{{ express.packageNum }}个包裹发出，点击查看物流详情</div>
      <div v-if="hasOneExpress" class="c-flex-column c-flex-grow1 c-w0">
        <div class="c-fs24 c-lh34 c-fc-xblack c-ml20">
          {{ express.shipName }}
        </div>
        <div class="c-mt10 c-fs22 c-lh28 c-fc-sblack c-flex-row c-flexw-wrap c-aligni-center c-ml20" v-if="express.shipNo">
          <span class="c-maxw360">运单编号：{{ express.shipNo }}</span>
          <div class="c-fs18 c-lh26 c-fc-xblack c-pv6 c-ph18 c-br18 c-bg-f2 c-ml20" @click.stop="copyText(express.shipNo)">复制</div>
        </div>
      </div>
      <i class="iconfont c-fc-sblack c-fs22 c-ml-auto" v-if="isShowGoExpressDetail">&#xe908;</i>
    </section>
    <!-- 收货地址信息 -->
    <section class="c-bg-white c-flex-row c-aligni-center c-ph24 c-pv30" v-if="isShowAddressInfo">
      <i class="iconfont theme-fc c-fs56 icon-dizhi"></i>
      <div class="c-ml20 c-flex-grow1 c-w0">
        <div class="c-fs24 c-lh34 c-fc-xblack">
          <span v-if="aggOrderDeliver.userName" class="c-mr20"> {{ aggOrderDeliver.userName }}</span>
          <span>{{ aggOrderDeliver.userMobile }}</span>
        </div>
        <div v-if="aggOrderDeliver.userAddress" class="c-mt10 c-fs22 c-lh28 c-fc-sblack c-flex-row c-aligni-center">地址：{{ aggOrderDeliver.userAddress }}</div>
      </div>
      <div v-if="isShowEditAddress" class="c-flex-row c-flex-center iconfont icon-bianji2 c-fc-sblack c-fs-28" @click="handleClickAddress"></div>
    </section>
    <!-- 自提地址信息 -->
    <section class="c-bg-white c-flex-column c-justify-sb c-ph24 c-pv24" v-if="isShowOffLine">
      <div class="c-flex-row c-justify-sb c-alignc-center">
        <div class="c-fs24 c-lh34 c-fc-xblack c-mb20 c-text-ellipsis1 c-fw-b">{{ express.offline.modName }}</div>
        <div class="c-flex-row c-alignc-center">
          <span class="iconfont c-fs30 theme-fc c-pr24 c-bd-r1 c-hh40" @click="getLocation">&#xe8fe;</span>
          <a class="iconfont c-fs30 icon-phone theme-fc c-pl24 c-hh40" :href="'tel:' + express.offline.contactMobile"></a>
        </div>
      </div>
      <div class="c-fs22 c-lh28 c-mb20 c-flex-row c-aligni-start">
        <span class="c-fc-sblack c-ww112">提货地址：</span>
        <span class="c-fc-xblack c-flex-grow1 c-w0 c-text-ellipsis2">{{ express.offline.address }}</span>
      </div>
      <div class="c-fs22 c-lh28 c-mb20 c-flex-row c-aligni-center">
        <span class="c-fc-sblack c-ww112">营业时间：</span>
        <div class="c-fc-xblack c-flex-grow1 c-text-ellipsis2 c-flex-row c-aligni-center">{{ offLineOpenDate }}</div>
      </div>
      <div class="c-fs22 c-lh28 c-flex-row c-aligni-center">
        <span class="c-fc-sblack c-ww112">联系电话：</span>
        <span class="c-fc-xblack c-flex-grow1 c-text-ellipsis2">{{ express.offline.contactMobile }}</span>
      </div>
      <template v-if="isShowDeliverNoInfo">
        <div class="c-fs24 c-lh34 c-fc-xblack c-mb20 c-pt20 c-fw-b c-bd-t1 c-mt20" v-if="aggOrderDeliver.deliverNo">提货码：{{ aggOrderDeliver.deliverNo }}</div>
        <div class="c-fs22 c-lh28 c-flex-row c-aligni-center c-fc-sblack">
          <span>提货人：</span>
          <span class="c-fc-xblack c-flex-grow1 c-text-ellipsis2">{{ aggOrderDeliver.userName }} {{ aggOrderDeliver.userMobile }}</span>
        </div>
      </template>
    </section>
    <!-- 搭配购主产品信息 -->
    <div v-if="collocationProdInfo" class="c-pv24 c-ph24 c-flex-row c-bg-white c-aligni-stretch c-mb12">
      <div class="c-ww180 c-maxh120 c-br16 c-text-hidden c-p">
        <img class="c-ww180 c-br16 imgCloseBig" :src="$addXossFilter(collocationProdInfo.prodCover || require('@/assets/defult270.png'))" alt="" />
        <span class="c-fc-white c-fs18 c-translucent-balck50 c-br-tl16 c-pa c-p-b0 c-p-r0 c-ph12 c-hh28 c-lh28">{{ collocationProdInfo.comboType == 1 ? '自选套餐' : '固定套餐' }}</span>
      </div>
      <div class="c-w0 c-flex-grow1 c-flex-column c-justify-sb c-ml12">
        <div class="c-fs28 c-fc-xblack c-fw600 c-text-ellipsis2 c-flex-shrink0">{{ collocationProdInfo.prodName }}</div>
        <div v-if="collocationProdInfo.comboType == 2 && collocationProdInfo.specType == 2" class="c-fs24 c-fc-gray c-text-ellipsis1">选择规格：{{ collocationProdInfo.specName }}</div>
      </div>
    </div>
    <!-- 商品信息 -->
    <section class="c-mt12 c-bg-white c-ph24">
      <!-- 商品列表 -->
      <div @click="clickGoShop(item)" :class="index != 0 ? 'c-bd-t1-f6' : ''" class="c-pv20" v-for="(item, index) in detailList" :key="index">
        <!-- 产品信息 -->
        <div class="c-flex-row">
          <!-- 商品封面 -->
          <div :class="EQUAL_SCALE_IMG_TYPE.includes(`${item.prodType}`) ? 'c-ww180 c-hh180' : 'c-ww180 c-hh120'" class="c-p c-br12 c-text-hidden c-translate-z-0">
            <CoverImg :coverUrl="getProdCover(item)" :prodType="item.prodType" />
            <div class="c-pa c-p-b8 c-p-r8 c-hh28 c-ph4 c-br4 c-flex-row c-flex-center c-translucent-balck60 c-fs20 c-fc-white">{{ getProdTypeText(item) }}</div>
          </div>
          <div class="c-flex-grow1 c-w0 c-ph20">
            <div class="c-fs24 c-fw-b c-wb-ba c-text-ellipsis2">
              <span v-if="PRESENT_SRC_MAP[item.prodSrc]" class="c-fs18 theme-bg c-fc-white c-ph4 c-br4 c-pv2 c-inlineblack c-mr4">赠品</span>{{ item.prodName }}
            </div>
            <!-- 正常购买的商品来源 显示对应的营销活动 一般来说只有主商品才是 -->
            <div v-if="!PRESENT_SRC_MAP[item.prodSrc]" class="c-fs0 c-flex-row c-flexw-wrap">
              <span v-for="tagItem in aggOrder.tags" :key="tagItem" v-show="MARKETING_TYPE_NAME_MAP[tagItem]" class="c-mt12 c-fs18 theme-bd1 theme-fc c-ph6 c-pv2 c-br8 c-mr10">{{
                MARKETING_TYPE_NAME_MAP[tagItem]
              }}</span>
            </div>
            <!-- 商城产品类型才有规格 -->
            <div v-if="item.prodType == PRODTYPE_ENUM.shopping" class="c-mt20">
              <collapse v-if="item.subSpecs" :default-height="52" class="c-fs20 c-fc-gray">
                <div>规格：{{ item.subSpecs }}</div>
              </collapse>
            </div>
            <!-- 搭配购多规格显示规格 -->
            <div v-if="item.prodsCollocation && item.prodsCollocation.comboType == 2 && item.prodsCollocation.specType == 2 && item.prodsCollocation.specName" class="c-pt8 c-fs20 c-fc-gray">
              选择规格：{{ item.prodsCollocation.specName }}
            </div>
            <!-- 圈子有效期显示 -->
            <div v-if="item.spec" class="c-pt8 c-fs20 c-fc-gray">{{ getProdValidityDate(item) }}</div>
          </div>
          <!-- 商品数量和价格 -->
          <div>
            <div v-if="getIsShowPrice(item)" class="c-fs24 c-fc-xblack c-textAlign-r">{{ '￥' | iosPriceFilter }}{{ item.prodPrice }}</div>
            <div class="c-fs22 c-fc-gray c-mt5 c-textAlign-r">x {{ item.quantity }}</div>
            <!-- 商品拆分发货状态 -->
            <div class="theme-fc c-fs22 c-textAlign-r c-mt10" v-if="isShowExpressStatus(item)">已发货</div>
            <div v-if="refundSuccess(item)" class="theme-fc c-fs22 c-textAlign-r c-mt10">已退款</div>
          </div>
        </div>
        <div class="c-flex-row c-aligni-center c-justify-sb pl180">
          <!-- 到付 -->
          <div class="c-fc-xblack c-fs22 c-mt10 c-bg-sgray c-br8 c-ww110 c-pv4 c-flex-row c-aligni-center c-justify-center" v-if="isShowShopValuationMethod(item)"><i class="iconfont c-fs22 c-mr12">&#xe60c;</i>到付</div>
          <div class="c-flex-grow1 c-flex-row c-aligni-center c-justify-end">
            <!-- 退款状态 -->
            <div v-if="getRefundStatusText(item)" class="c-fs22 c-ww130 c-h c-flex-row c-flex-center c-br25 c-ml24 c-pv10 c-fc-xblack c-bd1-ccc" @click.stop="goApplyRefund(item)">
              {{ getRefundStatusText(item) }}
            </div>
            <!-- 搭配购的退款信息 -->
            <div class="c-fs22 theme-fc" v-if="mainProdType == PRODTYPE_ENUM.collocationBuy && item.prodType != PRODTYPE_ENUM.collocationBuy && item.refundStatus > 0">
              退款成功：{{ '￥' | iosPriceFilter }}{{ item.refundMoney }}
            </div>
          </div>
        </div>
      </div>
    </section>
    <!-- 价格相关信息 -->
    <section class="c-bd-t1-f6 c-bg-white c-ph24 c-pt30">
      <div v-if="isShowDetailTotalPayMoney" class="c-pb24 c-flex-row c-justify-sb c-aligni-center c-fs20">
        <span class="c-flex-grow1 c-w0 c-fc-sblack">商品总价</span>
        <span class="c-fc-xblack">{{ '￥' | iosPriceFilter }}{{ moneyData.detailTotalPayMoney }}</span>
      </div>
      <div class="c-pb24 c-flex-row c-justify-sb c-aligni-center c-fs20" v-if="moneyData.postage * 1 > 0 || onlyValuationMethod">
        <span class="c-flex-grow1 c-w0 c-fc-sblack">运费</span>
        <span class="c-fc-xblack" v-if="moneyData.postage * 1 > 0">{{ '￥' | iosPriceFilter }}{{ moneyData.postage }}</span>
        <span class="c-fc-xblack" v-else-if="onlyValuationMethod">到付</span>
      </div>
      <div v-for="(item, index) in moneyData.discountCounts" :key="index" class="c-pb24 c-flex-row c-justify-sb c-aligni-center c-fs20">
        <span class="c-flex-grow1 c-w0 c-fc-sblack">{{ getDiscountTypeText(item) }}{{item.discountType == 9 ? `(${item.title})` : ''}}</span>
        <span class="c-fc-xblack">{{ showTag(item) }} {{ '￥' | iosPriceFilter }}{{ Math.abs(item.deductMoney).toFixed(2) }}</span>
      </div>
      <div class="c-pb24 c-flex-row c-justify-end c-aligni-center c-fs20">
        <span>{{ amountTxt }}：</span>
        <span class="theme-fc">{{ '￥' | iosPriceFilter }}{{ moneyData.actualReceivedAmount }}</span>
      </div>
    </section>
    <section class="c-hh72 c-flex-row c-fs22 c-bg-white c-flex-center c-bd-t1-f6" v-if="isShowGroupPurchaseTicket">
      <div @click="goGroupPurchaseTicket" class="c-fs22 c-ww148 c-hh50 c-flex-row c-flex-center theme-bg-10 theme-fc c-br25">我的票券</div>
    </section>
    <!-- 联系客服 -->
    <CustomServiceTmp :position="2" />
    <!-- 会员礼包 -->
    <section v-if="vipOrderGiftList.length" @click="clickOpenVipGift" class="c-mt12 c-bg-white c-flex-row c-ph24 c-fs20 c-justify-sb c-aligni-center c-pv12">
      <div class="c-fs24 c-fc-xblack c-fw600">会员礼包</div>
      <div class="iconfont c-fs40 c-fc-gray">&#xe7be;</div>
    </section>
    <!-- 推荐有礼礼包 -->
    <section v-if="hasRecommend" @click="openReCommendPresent" class="c-mt12 c-bg-white c-flex-row c-ph24 c-fs20 c-justify-sb c-aligni-center c-pv12">
      <div class="c-fs24 c-fc-xblack c-fw600">礼包</div>
      <div class="iconfont c-fs40 c-fc-gray">&#xe7be;</div>
    </section>
    <!-- 支付有礼 -->
    <section class="c-mt12 c-bg-white c-ph24 c-pv24 c-flex-row c-aligni-center c-justify-center" v-if="hasPayAward" @click="handleClickpayAward">
      <img v-if="payAward.awardType == 3" class="c-w100" src="https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/i/wap/payPolitely/activity.png" alt="" />
      <img v-if="payAward.awardType == 2" class="c-w100" src="https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/i/wap/payPolitely/gift.png" alt="" />
    </section>
    <!-- 订单信息 -->
    <section class="c-mt12 c-bg-white c-flex-column c-ph24 c-fs20 c-fc-sblack">
      <div class="c-pt34 c-pb28 c-flex-row c-justify-sb c-aligni-center">
        <span class="c-flex-grow1 c-w0 c-fc-sblack">订单编号</span>
        <div class="c-fc-xblack">{{ aggOrder.orderNo }}<span class="c-ph20 c-pv8 c-fs18 c-fc-xblack c-ml20 c-br20 c-bg-f2" @click="copyText(aggOrder.orderNo)">复制</span></div>
      </div>
      <div class="c-pb24 c-flex-row c-justify-sb c-aligni-center" v-if="aggOrder.mail">
        <span class="c-fc-sblack">邮箱</span>
        <span class="c-fc-xblack c-flex-grow1 c-w0 c-textAlign-r c-pl12">{{ aggOrder.mail }}</span>
      </div>
      <div class="c-pb24 c-flex-row c-justify-sb c-aligni-start" v-if="aggOrder.buyerRemark">
        <span class="c-fc-sblack">买家留言</span>
        <span class="c-fc-xblack c-flex-grow1 c-w0 c-textAlign-r c-pl12">{{ aggOrder.buyerRemark }}</span>
      </div>
      <div class="c-pb24 c-flex-row c-justify-sb c-aligni-center" v-if="aggOrder.addPoint > 0">
        <span class="c-flex-grow1 c-w0 c-fc-sblack">获得{{ customPointName }}</span>
        <span class="c-fc-xblack">{{ aggOrder.addPoint }}{{ customPointName }}</span>
      </div>
      <div class="c-pb24 c-flex-row c-justify-sb c-aligni-center" v-if="aggOrder.createdAt">
        <span class="c-flex-grow1 c-w0 c-fc-sblack">创建时间</span>
        <span class="c-fc-xblack">{{ aggOrder.createdAt }}</span>
      </div>
      <div class="c-pb24 c-flex-row c-justify-sb c-aligni-center" v-if="aggOrder.payAt">
        <span class="c-flex-grow1 c-w0 c-fc-sblack">付款时间</span>
        <span class="c-fc-xblack">{{ aggOrder.payAt }}</span>
      </div>
    </section>
    <!-- 发票信息 -->
    <section v-if="invoice && invoice.invoiceTitle" class="c-mt12 c-bg-white c-flex-column c-ph24 c-fs20 c-fc-sblack c-pb24">
      <div class="c-pt24 c-flex-row c-justify-sb c-aligni-center">
        <span>发票类型</span>
        <span class="c-fc-xblack">{{INVOICETYPE_MAP[invoice.invoiceType]}}</span>
      </div>
      <div class="c-pt24 c-flex-row c-justify-sb c-aligni-center">
        <span>发票抬头：</span>
        <span class="c-fc-xblack">{{ invoice.invoiceTitle }}</span>
      </div>
      <div class="c-pt24 c-flex-row c-justify-sb c-aligni-start" v-if="invoice.invoiceName">
        <span>{{ invoice.invoiceTitle }}名称：</span>
        <span class="c-fc-xblack c-flex-grow1 c-w0 c-textAlign-r c-pl12">{{ invoice.invoiceName }}</span>
      </div>
      <div class="c-pt24 c-flex-row c-justify-sb c-aligni-start" v-if="invoice.invoiceCode">
        <span>企业税号：</span>
        <span class="c-fc-xblack c-flex-grow1 c-w0 c-textAlign-r c-pl12">{{ invoice.invoiceCode }}</span>
      </div>
      <div class="c-pt24 c-flex-row c-justify-sb c-aligni-start" v-if="invoice.invoiceMail">
        <span>发票邮箱：</span>
        <span class="c-fc-xblack c-flex-grow1 c-w0 c-textAlign-r c-pl12">{{ invoice.invoiceMail }}</span>
      </div>
      <div class="c-pt24 c-flex-row c-justify-sb c-aligni-start" v-if="invoice.invoiceMobile">
        <span>发票手机号：</span>
        <span class="c-fc-xblack c-flex-grow1 c-w0 c-textAlign-r c-pl12">{{ invoice.invoiceMobile }}</span>
      </div>
      <div class="c-pt24 c-flex-row c-justify-sb c-aligni-start" v-if="invoice.registeredAddress">
        <span>注册地址：</span>
        <span class="c-fc-xblack c-flex-grow1 c-w0 c-textAlign-r c-pl12">{{ invoice.registeredAddress }}</span>
      </div>
      <div class="c-pt24 c-flex-row c-justify-sb c-aligni-start" v-if="invoice.registeredMobile">
        <span>注册电话：</span>
        <span class="c-fc-xblack c-flex-grow1 c-w0 c-textAlign-r c-pl12">{{ invoice.registeredMobile }}</span>
      </div>
      <div class="c-pt24 c-flex-row c-justify-sb c-aligni-start" v-if="invoice.accountBank">
        <span>企业开户行：</span>
        <span class="c-fc-xblack c-flex-grow1 c-w0 c-textAlign-r c-pl12">{{ invoice.accountBank }}</span>
      </div>
      <div class="c-pt24 c-flex-row c-justify-sb c-aligni-start" v-if="invoice.accountNo">
        <span>银行账号：</span>
        <span class="c-fc-xblack c-flex-grow1 c-w0 c-textAlign-r c-pl12">{{ invoice.accountNo }}</span>
      </div>
    </section>
    <!-- 用户协议 -->
    <section class="c-pv20 c-flex-row c-aligni-center c-flexw-wrap c-fs20 theme-fc" v-if="protocolInfo.length">
      <span class="c-fc-gray c-pl20">已阅读并同意</span>
      <span @click.stop="clickProtocol(item)" v-for="(item, index) in protocolInfo" :key="index">《{{ item.name }}》</span>
    </section>
    <footer v-if="isShowFooter" class="order-fotter c-bg-white c-hh80 c-flex-row c-justify-end c-ph24 c-pv12">
      <template v-if="isVideoChannel">
        <div class="c-fs24 c-hh52 c-lh52 c-flex-grow1">处理售后事宜请到微信--视频号---订单那处理</div>
      </template>
      <template v-else>
        <!-- 预售底部信息按钮 -->
        <div v-if="isShowBalanceOrderInfo" class="c-flex-grow1 c-flex-row c-aligni-center c-justify-sb c-fs24">
          <template v-if="isShowFinalBalancePay">
            {{ getLeaveTime }}
            <div
              class="c-br25 c-fs22 c-h c-ml24 c-hh52 c-lh52 c-textAlign-c c-ww130"
              :class="aggOrder.balanceOrderInfo.finalBalanceTimeStatus == 1 ? 'theme-bd1 theme-fc' : 'c-bd1-ccc c-fc-sgray'"
              @click.stop="clickPayOrder"
            >
              {{ orderStatus == 105 ? '支付尾款' : '继续支付' }}
            </div>
          </template>
          <template v-if="isShowBalanceOverTimePay">
            已结束，未在指定时间内支付尾款
            <div class="c-fs22 c-hh52 c-lh52 c-textAlign-c c-ml12 c-fc-xblack c-bd1-ccc c-ww116 c-br25" v-if="isShowRefundBalance" @click.stop="goApplyRefund()">退定金</div>
          </template>
        </div>
        <div v-if="isShowDeleteOrder" class="c-fs22 c-ww130 c-h c-flex-row c-flex-center c-fc-xblack c-bd1-ccc c-br25 c-ml24" @click="clickDelectOrder">删除订单</div>
        <div v-if="isShowCancelOrder" class="c-fs22 c-ww130 c-h c-flex-row c-flex-center c-fc-xblack c-bd1-ccc c-br25 c-ml24" @click="clickCancel">取消订单</div>
        <div v-if="isShowRefundList" class="c-fs22 c-ww130 c-h c-flex-row c-flex-center c-fc-xblack c-bd1-ccc c-br25 c-ml24" @click="clickRefundList">售后记录</div>
        <div v-if="isShowEditAddress" class="c-fs22 c-ww130 c-h c-flex-row c-flex-center c-fc-xblack c-bd1-ccc c-br25 c-ml24" @click="handleClickAddress">修改地址</div>
        <div v-if="isBuyerIsDelayReceive" class="c-fs22 c-ww130 c-h c-flex-row c-flex-center c-fc-xblack c-bd1-ccc c-br25 c-ml24" @click="clickDelayReceiveOrder">延长收货</div>
        <div v-if="isShowComment" class="c-fs22 c-ww130 c-h c-flex-row c-flex-center c-fc-xblack c-bd1-ccc c-br25 c-ml24" @click="clickComments">{{ getCommentStatus }}</div>
        <div v-if="isShowInvoiceBtn" class="c-fs22 c-ww130 c-h c-flex-row c-flex-center c-fc-xblack c-bd1-ccc c-br25 c-ml24" @click="clickShowInvoice">开票</div>
        <div v-if="isShowMyTicket" class="c-flex-1 c-fs22 c-h c-flex-row c-flex-center theme-bd1 theme-fc c-br25 c-ml24 c-ph24" @click="toTickInfo">查看票券</div>
        <div v-if="isShowActivityRecord" class="c-flex-1 c-fs22 c-h c-flex-row c-flex-center theme-bd1 theme-fc c-br25 c-ml24 c-ph24" @click="toMyActivity">活动报名记录</div>
        <div v-if="isShowConfirmReceipt" class="c-fs22 c-ww130 c-h c-flex-row c-flex-center theme-bd1 theme-fc c-br25 c-ml24" @click="clickConfirmReceipt">确认收货</div>
        <div v-if="isShowGoPay" class="c-fs22 c-ww130 c-h c-flex-row c-flex-center theme-bd1 theme-fc c-br25 c-ml24" @click="clickPay">去支付</div>
      </template>
    </footer>

    <!-- 推荐有礼 -->
    <RecommendPresent ref="recommendPresent" from="knowledgeOrderDetail" />
    <!-- 开票 -->
    <InvoiceModal ref="invoiceModal" :showInvoice="showInvoice" @getInvoice="setInvoice" @clickCloseModal="clickCloseModal" />
    <VipOrderGift ref="RefVipOrderGift" :vipOrderGiftList="vipOrderGiftList" />

    <!-- 选择退款类型 -->
    <ChangeRefundType ref="ChangeRefundType" @clickRefundType="clickRefundType" />

    <!-- 支付密码 -->
    <pay-password v-show="showPassword" :price="payMoney" @hidePwd="hidePwd" @confirmPwd="confirmPwd" />

    <!-- 支付 -->
    <PayTemplate
      v-if="isShowPay"
      :ckFrom="detailList[0].prodType"
      :balance="userInfo.balance * 1"
      :totalPrice="payMoney"
      :enablePayMall="payConf ? (payConf.enablePayMall == 0 ? false : true) : true"
      :enableWxpay="!!(payConf.enableWxpay == 1)"
      :isCanUseGiftCard="aggOrder.isCanUseGiftCard"
      :coinAmount="userInfo.coinAmount * 1"
      :totalCoin="moneyData.payCoinNum * 1"
      @closePay="closePay"
      @clickPayType="clickPayType"
    />
  </div>
</template>
<script>

import VipOrderGift from '@/components/templates/order/vipOrderGift.vue';
import CustomServiceTmp from '@/components/templates/custService/customServiceTmp.vue';
import RecommendPresent from '@/components/templates/recommendPresent';
import InvoiceModal from '@/components/templates/invoiceModal.vue';
import PayTemplate from '@/components/templates/common/pay/payTemplate.vue';
import ChangeRefundType from '@/components/templates/order/changeRefundType.vue';
import PayPassword from '@/components/templates/common/pay/payPassword.vue';
import CoverImg from '@/components/templates/common/coverImg.vue';
import qr from '@/utils/qr.js';
import { utilJs } from '@/utils/common.js';
import { goDetails } from '@/utils/goDetails.js';
import { MARKETING_TYPE_NAME_MAP, EQUAL_SCALE_IMG_TYPE } from '@/utils/constant.js';
const ORDER_STATUS_MAP = {
  1: '待付款',
  2: '待发货',
  3: '待收货',
  4: '交易完成',
  5: '交易关闭',
  103: '待成团',
  105: '等待支付尾款'
};
const SUB_ORDER_STATUS_TEXT_MAP = {
  101: '支付失败',
  102: '超时未支付',
  104: '拼团失败',
  106: '活动已结束，未支付尾款',
  201: '买家已付款，等待买家提货',
  202: '买家已付款，请尽快发货',
  8: '订单已全额退款',
  107: '商家取消订单',
  108: '买家取消订单',
  109: '库存不足',
  112: '活动已结束，未支付尾款', // 未支付尾款 但是支付尾款时间结束
  113: '取消预约', // 未支付尾款 但是支付尾款时间结束
  114: '兑换券已作废'
};
const DELIVER_TYPE_MAP = {
  0: '',
  1: '快递配送',
  2: '到店自提',
  3: '无需物流'
};
const EXPRESS_STATUS_MAP = {
  '0': '暂无物流信息',
  '1': '已揽收',
  '2': '在途中',
  '3': '已签收',
  '4': '问题件'
};
const PRESENT_SRC_MAP = {
  300: '(赠品)实物带货',
  302: '(赠品)赠送礼包',
  303: '(赠品)支付有礼',
  304: '(赠品)满减送'
};
const INVOICETYPE_MAP = { // 发票类型
  1: '纸质发票',
  2: '电子发票',
  3: '电子普通发票',
  4: '专票',
}
let isWechatPaying = false;
let countDownTime = '';
let automaticCancelTime = 0; //未支付自动关闭时间
let automaticRecipientTime = 0; //未收获自动收获时间
let currentDate = 0; //系统时间
let isTest = false; //判断是否时测试平台
export default {
  components: {
    VipOrderGift,
    CustomServiceTmp,
    RecommendPresent,
    InvoiceModal,
    PayTemplate,
    ChangeRefundType,
    PayPassword,
    CoverImg
  },
  data() {
    return {
      customPointName: localStorage.getItem('customPointName') || '积分',
      companyAuth: JSON.parse(localStorage.getItem('companyAuth')),
      DELIVER_TYPE_MAP: DELIVER_TYPE_MAP,
      ORDER_STATUS_MAP: ORDER_STATUS_MAP,
      EQUAL_SCALE_IMG_TYPE: EQUAL_SCALE_IMG_TYPE,
      MARKETING_TYPE_NAME_MAP: MARKETING_TYPE_NAME_MAP,
      PRESENT_SRC_MAP: PRESENT_SRC_MAP,
      PRODTYPE_ENUM: global.ckFrom,
      INVOICETYPE_MAP: INVOICETYPE_MAP,
      aggOrder: {}, //主订单信息
      moneyData: {}, //金额相关信息
      detailList: [], //产品列表
      aggOrderDeliver: null, //收货地址相关信息
      protocolInfo: [], //用户协议
      express: {}, //物流相关
      payAward: null, //支付有礼相关
      vipOrderGiftList: {}, //会员赠送礼包相关
      invoice: {}, //开票信息相关
      setting: {}, //设置相关
      userInfo: {}, //用户信息
      payConf: {}, //支付设置
      collocationProdInfo: null, //搭配购主产品信息
      showInvoice: false, //是否展示开票按钮
      currentGodId: '', //当前退款商品id
      showPassword: false, //显示输入密码
      isShowPay: false, //是否显示支付
      formTime: '', // 倒计时时间
      payMoney: 0 // 支付价格0
    };
  },
  computed: {
    // 是否展示取件码信息
    isShowDeliverNoInfo() {
      // 非未支付尾款的交易关闭 || 非等待支付尾款 || 非待付款
      return !((this.orderStatus == 5 && this.aggOrder.balanceOrderInfo && this.aggOrder.balanceOrderInfo.finalBalanceTimeStatus == 2) || this.orderStatus == 105 || this.orderStatus == 1)
    },
    // 显示是否预售退定金按钮
    isShowRefundBalance() {
      // 预售允许退定金 && 商城允许退款 && 不在售后中
      return this.aggOrder.balanceOrderInfo.enableRefund == 1 && this.aggOrder.enableRefund == 1 && this.setting.enableApplyRefund == 1 && !this.detailList.some(i => [100, 101, 102, 400].includes(i.afterSaleStatus))
    },
    // 判断是否展示订单内商品的到付
    isShowShopValuationMethod() {
      return function (item) {
       return item.valuationMethod && item.valuationMethod == 2 && item.freightMode == 1 && !this.onlyValuationMethod;
      }
    },
    // 判断订单到付
    onlyValuationMethod() {
      return this.aggOrder.orderSubType == 200 && this.detailList.every(item => item.valuationMethod && item.valuationMethod == 2 && item.freightMode == 1);
    },
    //是否显示商品总价
    isShowDetailTotalPayMoney() {
      //搭配购不显示单品价格的时候，也不显示总价
      if (this.mainProdType == global.ckFrom.collocationBuy && this.aggOrder.prodsCollocation && this.aggOrder.prodsCollocation.isShowPrice == 0) {
        return false;
      }
      return true;
    },
    mainProdType() {
      let prodInfo = this.detailList.length && this.detailList[0];
      //搭配购待支付订单的产品信息在collocationProdInfo
      prodInfo = this.collocationProdInfo || prodInfo;
      return prodInfo && prodInfo.prodType;
    },
    // 展示价格信息判断增减价格符号
    showTag() {
      return function(item) {
        return item.discountType == 0 && item.deductMoney > 0 ? '+' : '-';
      };
    },
    // 是否展示删除订单
    isShowDeleteOrder() {
      // 商城订单 && -100支付失败 -102取消支付 -303关闭订单 -302提交订单超时自动关闭
      return this.hasShoppingGoods && [-100, -102, -303, -302].includes(this.aggOrder.status);
    },
    // 是否展示延长收货
    isBuyerIsDelayReceive() {
      // 商城订单 && 订单状态是已发货 && 订单非自提 && 订单未被延迟发货过
      return this.hasShoppingGoods && this.orderStatus == 3 && this.isShowAddressInfo && this.aggOrder.buyerIsDelayReceive == 0;
    },
    // 展示倒计时文案
    getformTimeTxt() {
      if (!this.formTime) return;
      if (this.orderStatus == 1) {
        // 待支付
        return `剩${this.formTime}自动关闭订单`;
      } else if (this.orderStatus == 3) {
        // 自动收货
        return `剩余${this.formTime}自动完成交易`;
      } else if (this.orderStatus == 103) {
        // 拼团剩余时间
        return `拼团剩余时间：${this.formTime}`
      }
    },
    // 区分线下付款/实付款/需支付款(定金)
    amountTxt() {
      if (this.aggOrder.paymentMethod == 4) {
        return '线下付款';
      }
      // 待支付 || 支付关闭（超时未支付）
      if (this.orderStatus == 1 || (this.orderStatus == 5 && this.getHeaderStatusType() == 102)) {
        return this.aggOrder.balanceOrderInfo ? '需付定金' : '需付款';
      } else if (this.orderStatus == 105) {
        // 等待支付尾款
        return '已付定金';
      }
      return '实付款';
    },
    //获取是否积分商城产品
    getIsIntegralProduct() {
      if (!this.aggOrder) {
        return false;
      }
      if (!this.aggOrder.tags) {
        return false;
      }
      if (!this.aggOrder.tags.length) {
        return false;
      }
      return this.aggOrder.tags.includes(1024);
    },
    // 是否展示评价按钮
    isShowComment() {
      // 商城订单 && 交易完成 && 评价过/未评价
      return this.hasShoppingGoods && this.orderStatus == 4 && [1, 2].includes(this.aggOrder.commentStatus);
    },
    // 获取评价按钮文案
    getCommentStatus() {
      // 商城评价状态 -1：评价过被刪除 1：评价过 2：未评价
      const map = {
        1: '查看评价',
        2: '评价'
      };
      return map[this.aggOrder.commentStatus] || '';
    },
    // 退款成功
    refundSuccess() {
      return function(item) {
        // 不是搭配购 && 退款成功 (200:退款成功 201/202:商家主动退款 203:预约师资-取消预约 205库存不足退款 204自动退款) && 非赠品
        return this.mainProdType != global.ckFrom.collocationBuy && [200, 201, 202, 203, 205, 204].includes(item.afterSaleStatus) && !PRESENT_SRC_MAP[item.prodSrc];
      };
    },
    // 是否展示修改地址按钮
    isShowEditAddress() {
      // 商城订单 && (待支付且非预售 || 已支付未发货) && 没有修改地址记录且是实体发货商品
      return (
        this.hasShoppingGoods &&
        ((this.orderStatus == 1 && !this.aggOrder.balanceOrderInfo) || (this.orderStatus == 2 && this.express.isSendSomeGoods == 0)) &&
        this.express.updateAddressTime == null &&
        this.detailList[0] &&
        this.detailList[0].deliverType != 2
      );
    },
    subOrderStatusText() {
      if (!this.aggOrder) {
        return '';
      }
      if (!this.aggOrder.orderNo) {
        return '';
      }
      let result = this.getHeaderStatusType();
      let text = SUB_ORDER_STATUS_TEXT_MAP[result] || '';
      if (result == 111) {
        return this.isShowActivityRecord ? '已签到' : '提问超时未回答';
      }
      return text;
    },
    // 获取尾款支付日期如下： 3月28日 9:30
    getLeaveTime() {
      // 尾款还未开始 尾款支付开始时间+开始支付尾款 尾款开始支付 尾款支付截至时间+前支付尾款
      if (this.aggOrder.balanceOrderInfo == null || this.aggOrder.balanceOrderInfo.leaveEndTime == null || this.aggOrder.balanceOrderInfo.leaveStartTime == null) return;
      let leaveEndTime = new Date(this.aggOrder.balanceOrderInfo.leaveEndTime.replace(/-/g, '/'));
      let leaveStartTime = new Date(this.aggOrder.balanceOrderInfo.leaveStartTime.replace(/-/g, '/'));
      leaveEndTime = new Date(leaveEndTime.getTime() + 1000); // 前支付尾款 得加一秒 让展示更严谨
      if (this.aggOrder.balanceOrderInfo.finalBalanceTimeStatus == 0) {
        return `${this.aggOrder.balanceOrderInfo.finalBalanceTimeStatus == 0 ? '' : '请在'}${leaveStartTime.getMonth() + 1}月${leaveStartTime.getDate()}日 ${
          leaveStartTime.getHours() > 9 ? '' + leaveStartTime.getHours() : '0' + leaveStartTime.getHours()
        }:${leaveStartTime.getMinutes() > 9 ? '' + leaveStartTime.getMinutes() : '0' + leaveStartTime.getMinutes()}开始支付尾款`;
      } else if (this.aggOrder.balanceOrderInfo.finalBalanceTimeStatus == 1) {
        return `${this.aggOrder.balanceOrderInfo.finalBalanceTimeStatus == 0 ? '' : '请在'}${leaveEndTime.getMonth() + 1}月${leaveEndTime.getDate()}日 ${
          leaveEndTime.getHours() > 9 ? '' + leaveEndTime.getHours() : '0' + leaveEndTime.getHours()
        }:${leaveEndTime.getMinutes() > 9 ? '' + leaveEndTime.getMinutes() : '0' + leaveEndTime.getMinutes()}前支付尾款`;
      }
    },
    // 判断是否尾款超时支付
    isShowBalanceOverTimePay() {
      // 超时未支付/用户取消订单不展示
      return this.aggOrder.balanceOrderInfo && this.aggOrder.balanceOrderInfo.finalBalanceTimeStatus == 2 && this.getHeaderStatusType() != 7 && this.getHeaderStatusType() != 102 && this.getHeaderStatusType() != 108;
    },
    // 是否展示预售支付按钮
    isShowFinalBalancePay() {
      return this.aggOrder.balanceOrderInfo && [0, 1].includes(this.aggOrder.balanceOrderInfo.finalBalanceTimeStatus) && this.orderStatus == 105;
    },
    // 是否展示预售底部信息
    isShowBalanceOrderInfo() {
      return this.aggOrder.balanceOrderInfo && this.aggOrder.balanceOrderInfo.finalBalanceStatus == 0 && (this.isShowFinalBalancePay || this.isShowBalanceOverTimePay);
    },
    orderStatus() {
      if (!this.aggOrder) {
        return '';
      }
      if (!this.aggOrder.orderNo) {
        return 0;
      }

      let result = this.getHeaderStatusType();
      if ([7, 8, 101, 102, 104, 106, 107, 108, 109, 110, 111, 112, 113, 114].includes(this.getHeaderStatusType())) {
        // 交易关闭
        result = 5;
      } else if ([105].includes(this.getHeaderStatusType())) {
        // 等待支付尾款
        result = 105;
      }

      return result;
    },
    //视频号订单
    isVideoChannel() {
      if (!this.aggOrder) {
        return false;
      }
      return this.aggOrder.fromApp == 10 || this.aggOrder.fromApp == 11;
    },
    // 是否是预售订单
    isPresale() {
      if (!this.aggOrder) {
        return false;
      }
      return this.aggOrder.tags && this.aggOrder.tags.length > 0 && this.aggOrder.tags.includes(67108864);
    },
    // 是否是虚拟币支付
    isVirtualCoin() {
      if (!this.aggOrder) {
        return false;
      }
      return this.aggOrder.paymentMethod == 14;
    },
    hasShoppingGoods() {
      if (!this.aggOrder) {
        return false;
      }
      if (!this.detailList) {
        return false;
      }
      if (!this.detailList.length) {
        return false;
      }
      //是商城订单 || 产品列表里有商城商品
      return this.aggOrder.orderSubType == 200 || this.detailList.some(i => i.prodType == global.ckFrom.shopping);
    },

    isShowExpressInfo() {
      if (!this.express) {
        return false;
      }
      if (!this.express.deliverTypeArr) {
        return false;
      }
      //有物流方式
      if (!this.express.deliverTypeArr.length) {
        return false;
      }
      //有线下自提的
      if (this.express.deliverTypeArr.some(i => i == 2)) {
        return false;
      }
      //有物流单号 || 有多个物流 || 有无需物流
      let hasExpressInfo = this.express.shipNo || this.express.packageNum > 1 || this.express.deliverTypeArr.some(item => item == 3);
      return hasExpressInfo;
    },
    expressStatusText() {
      return EXPRESS_STATUS_MAP[this.express.state];
    },
    isShowExpressStatus() {
      return function(item) {
        // 待发货状态 && 该已发货 && 拆分发货
        return this.orderStatus == 2 && item.logiStatus == 2 && this.express.isSplitPackage == 1;
      };
    },
    noNeedExpress() {
      //无需物流方式
      if (!this.isShowExpressInfo) {
        return '';
      }
      //(没有拆分发货 && 全部发货的无需物流) || (拆分发货 && 有且只有一个无需物流的发货)
      return (
        (this.express.isSplitPackage == -1 && this.express.deliverTypeArr.every(item => item == 3)) ||
        (this.express.isSplitPackage == 1 && this.express.deliverTypeArr.some(item => item == 3) && this.express.packageNum == 1)
      );
    },
    hasTwoExprress() {
      if (!this.isShowExpressInfo) {
        return '';
      }
      return this.express.packageNum > 1;
    },
    hasOneExpress() {
      if (!this.isShowExpressInfo) {
        return '';
      }
      //(没有拆包 && 有快递信息) || (拆分发货 && 发货包裹只有一个)
      return (this.express.isSplitPackage == -1 && this.express.shipNo) || (this.express.isSplitPackage == 1 && this.express.packageNum == 1);
    },
    isShowGoExpressDetail() {
      //存在物流信息 && 不是无需物流
      return this.isShowExpressInfo && !this.noNeedExpress;
    },
    isShowAddressInfo() {
      //有收获地址 && 非线下自提
      return this.aggOrderDeliver && !this.isShowOffLine;
    },
    isShowOffLine() {
      return this.express.offline && this.express.offline.modId;
    },
    offLineOpenDate() {
      if (!this.isShowOffLine) {
        return '';
      }
      if (!this.express.offline.openStartAt) {
        return '';
      }
      if (!this.express.offline.openEndAt) {
        return '';
      }
      let stArr = this.express.offline.openStartAt.split(':');
      let enArr = this.express.offline.openEndAt.split(':');
      if (stArr.length < 2) {
        return '';
      }
      if (enArr.length < 2) {
        return '';
      }
      let timeStr = `${stArr[0]}:${stArr[1]}-${enArr[0]}:${enArr[1]}`;
      return `${this.express.offline.openDate} ${timeStr}`;
    },
    //是否显示企业团购票夹
    isShowGroupPurchaseTicket() {
      //是企业团购 && 不是支付中
      return this.aggOrder.tags && this.aggOrder.tags.includes(1048576) && this.orderStatus != 1;
    },
    //是否显示推荐有礼信息
    hasRecommend() {
      return this.aggOrder.isBeTaskReward == 1 && this.aggOrder.extId && this.aggOrder.extId != -1;
    },
    //是否显示支付有礼
    hasPayAward() {
      if (!this.payAward) {
        return false;
      }
      // awardType:1优惠卷 2商城 3参与活动
      //商城赠送虚拟产品，新的数据会自动领取，旧数据需要手动领取，保留领取入口
      let isShowShopPayAward = this.aggOrder.orderSubType == 200 && this.payAward.awardType == 2;
      return this.payAward.awardType == 3 || isShowShopPayAward;
    },

    //是否显示底部浮动按钮
    isShowFooter() {
      // (按钮展示判断条件 || 视频号) && 非积分商城订单
      return (
        (this.isShowBalanceOrderInfo ||
          this.isShowRefundList ||
          this.isShowCancelOrder ||
          this.isShowGoPay ||
          this.isShowConfirmReceipt ||
          this.isShowMyTicket ||
          this.isShowActivityRecord ||
          this.isShowInvoiceBtn ||
          this.isShowEditAddress ||
          this.isShowComment ||
          this.isVideoChannel ||
          this.isBuyerIsDelayReceive ||
          this.isShowDeleteOrder) &&
        !this.getIsIntegralProduct
      );
    },
    //是否显示售后记录
    isShowRefundList() {
      //i.afterSaleStatus > 0 && i.afterSaleStatus != 204 204存在售后行为默认已退款，但是不生成售后记录 ，就表示发起过售后 && 非赠送礼包 && 非超库存退款
      return this.hasShoppingGoods && this.detailList.some(i => i.afterSaleStatus > 0 && i.afterSaleStatus != 204) && !this.aggOrder.tags.includes(8388608) && this.aggOrder.status != -306;
    },
    isShowConfirmReceipt() {
      return this.hasShoppingGoods && this.orderStatus == 3;
    },

    isShowCancelOrder() {
      //待支付订单可以取消
      return this.orderStatus == 1;
    },
    isShowGoPay() {
      //待支付订单可以去支付
      return this.orderStatus == 1;
    },
    isShowMyTicket() {
      //活动订单 && 有票券信息 && (交易成功订单 || 签到退款订单)
      let isShow = this.orderStatus == 4 || this.aggOrder.status == -309;
      return this.isShowActivityRecord && this.aggOrder.prodEnrollInfo && this.aggOrder.prodEnrollInfo.identCode && isShow;
    },
    isShowActivityRecord() {
      //活动订单才有报名记录
      if (!this.detailList.length) {
        return false;
      }
      return this.detailList[0].prodType == global.ckFrom.activity;
    },
    isShowInvoiceBtn() {
      //纯商城订单 && 非兑换订单 && 非赠品的商品 && 开启开票 && 还没有开票过 && 非拼团中 && 订单状态不是未付款或者交易关闭 && 订单实付大于0 && 非线下实付订单
      return (
        // this.aggOrder.orderSubType == 200 &&
        this.aggOrder.orderType != 2 &&
        // this.detailList.find(item => ![300, 302, 303, 304].includes(item.prodSrc) && item.prodType == global.ckFrom.shopping) &&
        this.detailList.find(item => ![300, 302, 303, 304].includes(item.prodSrc)) &&
        this.setting &&
        this.setting.isInvoice == 1 &&
        this.invoice &&
        !this.invoice.invoiceTitle &&
        this.orderStatus > 1 &&
        this.orderStatus != 5 &&
        this.orderStatus != 103 &&
        this.orderStatus != 105 &&
        this.moneyData.actualReceivedAmount > 0 &&
        this.aggOrder.paymentMethod != 4
      );
    }
  },
  created() {
    utilJs.appShare(this);
  },
  mounted() {
    setDocumentTitle('订单详情');
    this._orderNo = this.$route.query.orderNo || '';
    this._orderId = this.$route.query.orderId || ''; // 旧知识产品订单
    this._goId = this.$route.query.goId || ''; //旧商城订单
    this._mallGodId = ''; //赠送礼包的商城订单id 用来收货和修改包裹信息用
    this.$store.commit('updateOrderDetailNo', this._orderNo);
    this.wechatShare();
    this.initData();
  },
  beforeDestroy() {
    this.$cjConfirm.hide();
    clearInterval(this._timeControl);
  },
  methods: {
    // 点击删除订单
    clickDelectOrder() {
      let that = this;
      that.$cjConfirm({
        title: '确定要删除该订单', //
        titleCenter: true, //标题是否居中
        message: '',
        messageCenter: true, //内容是否居中
        showMasker: true, //是否显示透明背景
        clickCloseModal: false, //是否点击透明背景关闭弹窗
        showCancelButton: true, //是否显示取消按钮
        cancelButtonText: '', //取消按钮文本
        confirmButtonText: '', //确认按钮文本
        onConfirm() {
          utilJs.getMethod(global.apiurl + 'goodsOrders/deleteClosedOrder/' + that._mallGodId, res => {
            that.$showCjToast({
              text: res.data,
              type: 'success',
            });
            that.$router.back(-1);
          });
        },
        onCancel() {}
      });
    },
    // 将秒转化为天：时格式
    timeToStr(timeSecond) {
      let day = 0;
      let hour = 0;
      let minute = 0;
      let second = 0;
      if (timeSecond >= 60) {
        minute = parseInt(timeSecond / 60);
        second = parseInt(timeSecond % 60);
        if (minute >= 60) {
          hour = parseInt(minute / 60);
          minute = parseInt(minute % 60);
        }
        if (hour >= 60) {
          day = parseInt(hour / 24);
          hour = parseInt(hour % 24);
        }
      } else {
        second = timeSecond;
      }
      hour = hour >= 10 ? hour : '0' + hour;
      minute = minute >= 10 ? minute : '0' + minute;
      second = second >= 10 ? second : '0' + second;
      if (this.orderStatus == 1) {
        if (hour > 0) {
          return hour + '时' + minute + '分';
        } else {
          return minute + '分' + second + '秒';
        }
      } else if (this.orderStatus == 3) {
        if (day > 0) {
          return day + '天' + hour + '时';
        } else {
          return minute + '分' + second + '秒';
        }
      } else if (this.orderStatus == 103) {
          return `${day}天${hour}时${minute}分${second}秒`;
      }
    },
    timeControl() {
      let that = this;
      clearInterval(that._timeControl);
      that._timeControl = setInterval(function() {
        currentDate++;
        countDownTime--;
        if (countDownTime <= 0) {
          if (that.orderStatus == 1) {
            // 时间到未付款状态改变未超时关闭状态
            that.$set(that.aggOrder, 'status', -301); // 超时关闭
          } else if (that.orderStatus == 3) {
            // 时间到待收货改为完成状态
            that.$set(that.aggOrder, 'status', 100); // 自动收货
            that.$set(that.aggOrder, 'logiStatus', 3);
          } else if (that.orderStatus == 103) {
            // 拼团中
            that.initData();
          }
          clearInterval(that._timeControl);
        }
        that.formTime = that.timeToStr(countDownTime);
      }, 1000);
    },
    // 倒计时
    setCutDown() {
      // 视频号小店、非商品订单且存在营销活动(除拼团中)不支持倒计时
      if (this.isVideoChannel || (this.aggOrder.orderSubType == 100 && this.aggOrder.tags.some(item => [8, 4096].includes(item)))) return;
      // 待支付拼团不显示待支付时间
      if (this.orderStatus == 1 && !this.aggOrder.tags.includes(2)) {
        if (automaticCancelTime - currentDate >= 0) {
          countDownTime = automaticCancelTime - currentDate;
          this.timeControl();
        } else {
          this.$set(this.aggOrder, 'status', -301); // 超时关闭
        }
      } else if (this.orderStatus == 3) {
        if (this.detailList.some(item => item.afterSaleStatus != 0).length > 0) {
          this.formTime = '';
        } else if (automaticRecipientTime - currentDate >= 0) {
          countDownTime = automaticRecipientTime - currentDate;
          this.timeControl();
        } else {
          this.$set(this.aggOrder, 'status', 100); // 自动收货
          this.$set(this.aggOrder, 'logiStatus', 3);
        }
      } else if (this.orderStatus == 103) { // 拼团成团倒计时
        let cllageEnd = this.aggOrder.collageData.endTime;
        cllageEnd = new Date(cllageEnd).getTime() / 1000;
        if (cllageEnd - currentDate >= 0) {
          countDownTime = cllageEnd - currentDate;
          this.timeControl();
        } else {
          this.initData();
        }
      }
    },
    // 延长收获
    clickDelayReceiveOrder() {
      let that = this;
      isTest = window.location.href.indexOf('http://kptest') > -1 || window.location.href.indexOf('https://kptest') > -1; // 正式平台用3天，测试平台用3分钟
      let judgeTime = isTest ? 60 * 3 : 24 * 60 * 60 * 3;
      if (automaticRecipientTime - currentDate <= judgeTime) {
        that.$cjConfirm({
          title: '延长收货时间', //
          titleCenter: true, //标题是否居中
          message: '收货时间已延长3天，头部的时间自动加上3天时间',
          messageCenter: true, //内容是否居中
          showMasker: true, //是否显示透明背景
          clickCloseModal: false, //是否点击透明背景关闭弹窗
          showCancelButton: false, //是否显示取消按钮
          cancelButtonText: '', //取消按钮文本
          confirmButtonText: '我知道了', //确认按钮文本
          onConfirm() {
            utilJs.getMethod(global.apiurl + 'goodsOrders/delayReceiveOrder/' + that._mallGodId, res => {
              countDownTime = countDownTime + judgeTime;
              that.formTime = that.timeToStr(countDownTime);
              that.$set(that.aggOrder, 'buyerIsDelayReceive', 1);
            });
          }
        });
      } else {
        that.$cjConfirm({
          title: '延长收货时间', //
          titleCenter: true, //标题是否居中
          message: '延长收货需距离结束时间3天才能申请哦~',
          messageCenter: true, //内容是否居中
          showMasker: true, //是否显示透明背景
          clickCloseModal: false, //是否点击透明背景关闭弹窗
          showCancelButton: false, //是否显示取消按钮
          cancelButtonText: '', //取消按钮文本
          confirmButtonText: '我知道了', //确认按钮文本
          onConfirm() {}
        });
      }
    },
    getGuideData() {
      let _this = this;
      if (_this.aggOrder.balanceOrderInfo && _this.aggOrder.balanceOrderInfo.finalBalanceStatus == 0 && _this.orderStatus == 1) {
        _this.paySuccessCallBack();
        return;
      }
      utilJs.getMethod(
        global.apiurl + 'common/getGuideData?prodId=' + _this.detailList[0].mgId + '&prodType=' + global.ckFrom.shopping,
        function(res) {
          _this.guideData = res;
          // 开启引导购买展示 || 该商品购买能赠送积分展示
          if (_this.guideData.isNeedShowPayPage == 1 || (_this.guideData.givenPoints && _this.guideData.givenPoints > 0)) {
            _this.$routerGo(_this, 'replace', {
              path: '/homePage/payPolitely/payPolitely',
              query: {
                orderId: _this._mallGodId,
                prodType: _this.detailList[0].prodType
              }
            });
          } else {
            _this.paySuccessCallBack();
          }
        },
        failRes => {
          _this.paySuccessCallBack();
        }
      );
    },
    paySuccessCallBack() {
      if (this.getIsIntegralProduct) {
        sessionStorage.setItem('isGiftOrderPay', '1');
      }
      if (this.payType == 0) {
        // 微信支付
        this.$router.go(-1);
      } else {
        this.$routerGo(this, 'push', {
          path: `/member/myOrder/allOrderList?goId=${this._mallGodId}&orderType=-1`
        });
      }
    },
    hidePwd() {
      this.showPassword = false;
    },
    confirmPwd(pwd) {
      let _this = this;
      //余额支付
      let data = { goId: this._mallGodId, payPwd: pwd };
      // 预售尾款再生成待支付订单，则不需要在进入订单结算计算价格
      if (_this.aggOrder.balanceOrderInfo && _this.aggOrder.balanceOrderInfo.finalBalanceOrderId && _this.aggOrder.balanceOrderInfo.payMoney) {
        data.goId = _this.aggOrder.balanceOrderInfo.finalBalanceOrderId;
      }
      if (sessionStorage.getItem('promotedAccountId')) {
        data.promotedAccountId = sessionStorage.getItem('promotedAccountId');
      }
      utilJs.yueMallPay(data, res => {
        this.$showCjToast({
          text: '支付成功',
          type: 'success',
        }).then(() => {
          // 生成新得订单则去除状态订单号值
          _this.$store.commit('updateOrderDetailNo', '');
          _this.getGuideData();
        });
      });
    },
    // 关闭支付
    closePay() {
      this.isShowPay = false;
    },
    //点击支付
    clickPayType(payType) {
      if (payType == 1) {
        this.showPassword = true;
      } else if (payType == 2) {
        // 小程序环境不能跳充值页面
        if (this.$isWxApp() && this.moneyData.payCoinNum > this.userInfo.coinAmount) {
          return;
        }
        if (this.moneyData.payCoinNum > this.userInfo.coinAmount) {
          // 选择虚拟币支付，且虚拟币余额不足，则跳到虚拟币充值页面
          let query = this.$route.query || {};
          query.isComeFrom = 'mallOrderDetail';
          sessionStorage.setItem('giftCardBack', JSON.stringify(query));
          this.$routerGo(this, 'replace', { path: '/member/giftCard/rechargeCard' });
          return;
        }
        this.mallGiftCardPay(this._mallGodId);
      } else if (payType == 3) {
        // 支付宝支付
        let data = { goId: this._mallGodId };
        // 预售尾款再生成待支付订单，则不需要在进入订单结算计算价格
        if (this.aggOrder.balanceOrderInfo && this.aggOrder.balanceOrderInfo.finalBalanceOrderId && this.aggOrder.balanceOrderInfo.payMoney) {
          data.goId = this.aggOrder.balanceOrderInfo.finalBalanceOrderId;
        }
        utilJs.postMethod(global.apiurl + 'payment/alipayConf', data, aliRes => {
          // 生成新得订单则去除状态订单号值
          this.$store.commit('updateOrderDetailNo', '');
          this.$routerGo(this, 'replace', { path: '/homePage/course/aliPayMiddlePage', query: { orderId: aliRes.orderNo } });
        });
      } else {
        //  pc浏览器购买弹窗
        if (!utilJs.isWeiXin() && !utilJs.isMobileUserAgent() && !utilJs.isIOSAppALL() && !utilJs.isAndroidApp()) {
          this.showPassword = false;
          let hurl = window.location.href;
          let qrUrl = qr.getQrUrl({ url: hurl, size: 120 });
          this.$cjConfirm({
            title: 'pc微信扫码支付',
            message:  `<img src="${qrUrl}" style="margin-top: 10px;" class="c-ww200 c-hh200 c-center"/><p style="margin-top: 10px;">请使用<span style="color: red">当前账号的微信扫码</span>支付</p>`,
            cancelButtonText:'取消支付',
            confirmButtonText:'支付完成',
          })
          return;
        }
        this.wechatPay();
      }
    },
    //选择微信支付
    wechatPay() {
      let u = navigator.userAgent;
      let isAndroid = u.indexOf('APPLogin') > -1; //android终端
      let isiOS = u.indexOf('IOSLogin') > -1 || u.indexOf('IOSNewLogin') > -1 || navigator.userAgent.indexOf('IOSNewApp') > -1; //ios终端
      if (isAndroid == true || isiOS == true) {
        let backUrl = window.location.href.split('#')[0] + '#/member/myOrder/allOrderList?orderType=-1';
        let data = { orderId: this._mallGodId };
        // 预售尾款再生成待支付订单，则不需要在进入订单结算计算价格
        if (this.aggOrder.balanceOrderInfo && this.aggOrder.balanceOrderInfo.finalBalanceOrderId && this.aggOrder.balanceOrderInfo.payMoney) {
          data.orderId = this.aggOrder.balanceOrderInfo.finalBalanceOrderId;
        }
        utilJs.appPay(data, 0, 0, 0, 2, backUrl);
      } else {
        if (isWechatPaying) {
          return;
        }
        isWechatPaying = true;
        let data = { goId: this._mallGodId };
        // 预售尾款再生成待支付订单，则不需要在进入订单结算计算价格
        if (this.aggOrder.balanceOrderInfo && this.aggOrder.balanceOrderInfo.finalBalanceOrderId && this.aggOrder.balanceOrderInfo.payMoney) {
          data.goId = this.aggOrder.balanceOrderInfo.finalBalanceOrderId;
        }
        utilJs.wechatMallPay(
          data,
          res => {
            // 生成新得订单则去除状态订单号值
            this.$store.commit('updateOrderDetailNo', '');
            isWechatPaying = false;
            this.getGuideData();
          },
          fres => {
            isWechatPaying = false;
          }
        );
      }
    },
    // 选择虚拟币支付
    mallGiftCardPay(goId) {
      if (this._isPayGiftCard) return;
      this._isPayGiftCard = true;
      utilJs.postMethod(
        `${global.apiurl}payment/mallGiftCardPay`,
        { goId: goId },
        res => {
          this._isPayGiftCard = false;
          this.$showCjToast({
            text: '支付成功',
            type: 'success',
          }).then(() => {
            // 生成新得订单则去除状态订单号值
            this.$store.commit('updateOrderDetailNo', '');
            this.paySuccessCallBack();
          });
        },
        () => {
          this._isPayGiftCard = false;
        }
      );
    },
    // 评论操作
    clickComments() {
      const commentStatus = this.aggOrder.commentStatus;
      if (commentStatus == 2) {
        this.$routerGo(this, 'push', {
          path: '/mall/shopComments/addShopComment',
          query: {
            goId: this._mallGodId,
            type: 1 // 1添加订单评论
          }
        });
      } else if (commentStatus == 1) {
        this.$routerGo(this, 'push', {
          path: '/mall/shopComments/shopCommentDetail',
          query: {
            id: this._mallGodId,
            type: 1 // 1查看订单评论详情
          }
        });
      }
    },
    // 商城商品下单
    getShopInfo(prodId, palId) {
      utilJs.getMethod(`${global.apiurl}goods/goodsDetail?mgId=${prodId}${palId ? '&palId=' + palId : ''}`, res => {
        const shopDetail = res.goods;
        const freeShipping = res.freeShipping;
        const payAwardData = res.payAwardData;
        let shopInfo = [
          {
            mgId: shopDetail.mgId,
            mcId: '',
            avatar: shopDetail.avatar ? shopDetail.avatar : '',
            pointsDeduct: 0,
            name: shopDetail.name,
            price: payAwardData ? payAwardData.price : shopDetail.price,
            originalPrice: shopDetail.originalPrice,
            quantity: 1,
            shopSpecInfo: '',
            gsiiId: '',
            postage: shopDetail.postage,
            isMail: shopDetail.isMail,
            isMallExpressDeliver: shopDetail.isMallExpressDeliver,
            isMallOfflineDeliver: shopDetail.isMallOfflineDeliver,
            stock: 1,
            salesStock: '',
            collageStock: '',
            freeShipping: freeShipping,
            isFlashSales: false,
            isCollage: false,
            pId: '',
            noLimit: false,
            vipDiscount: shopDetail.vipDiscount,
            svipDiscount: shopDetail.svipDiscount,
            agentDiscount: shopDetail.agentDiscount,
            partnerDiscount: shopDetail.partnerDiscount,
            branchDiscount: shopDetail.branchDiscount,
            isPayAward: true,
            limitType: -1,
            limitNumber: 0,
            purchasedNum: 0,
            relData: shopDetail.relData && shopDetail.relData.length > 0 ? shopDetail.relData : [],
            vipDiscountType: shopDetail.vipDiscountType || 1
          }
        ];
        if (shopDetail.valuationMethod && shopDetail.valuationMethod == 2 && shopDetail.freightMode == 1) {
          shopInfo.valuationMethod = shopDetail.valuationMethod;
        }
        if (this.aggOrder.balanceOrderInfo) {
          shopInfo[0].isPayAward = false;
          shopInfo[0].presale = this.aggOrder.balanceOrderInfo;
          shopInfo[0].moneyType = 3; // 预售尾款
          shopInfo[0].gsiiId = this.detailList[0].gsiiId;
          shopInfo[0].stock = this.detailList[0].quantity;
          shopInfo[0].quantity = this.detailList[0].quantity;
          shopInfo[0].minOrderQuantity = this.detailList[0].quantity;
          shopInfo[0].price = this.aggOrder.balanceOrderInfo.aPrice;
          shopInfo[0].enableDeduction = this.aggOrder.balanceOrderInfo.enableDeduction;
          shopInfo[0].pointsDeduct = shopDetail.pointsDeduct; //限时购不能使用积分
          shopInfo[0].shopSpecInfo = this.detailList[0].subSpecs;
          shopInfo[0].presale.deposit = this.aggOrder.balanceOrderInfo.deposit / this.detailList[0].quantity; // 这边返回得定金是已经乘以数量
          if (this.express.offline) {
            localStorage.setItem('mod', JSON.stringify(this.express.offline));
          }
        }
        console.log(this.detailList[0]);
        console.log(shopInfo);
        sessionStorage.setItem('shopBuyInfo', JSON.stringify(shopInfo));
        let goPath = `/mall/shopSettlement/shopSettlement?shopNo=${prodId}${palId ? '&palId=' + palId : ''}${this.aggOrder.balanceOrderInfo ? '&goId=' + this._mallGodId : ''}`;
        this.$routerGo(this, 'push', {
          path: goPath
        });
      });
    },
    //提交订单
    clickSubmitOrder() {
      utilJs.getMethod(global.apiurl + 'mall/handleOrderBefore?orderId=' + this._mallGodId, res => {
        //拼团待支付订单先查询是否还可以支付
        if (res.status == 1) {
          this.isShowPay = true;
        } else {
          this.$showCjToast({
            text: res.error,
            type: 'warn',
          });
        }
      });
    },
    // 预售订单详情点击支付
    clickPayOrder() {
      if (this.aggOrder.balanceOrderInfo && this.aggOrder.balanceOrderInfo.finalBalanceOrderId && this.aggOrder.balanceOrderInfo.payMoney) {
        this.payMoney = this.aggOrder.balanceOrderInfo.payMoney;
        this.clickSubmitOrder();
        return;
      }
      // 未开始支付尾款不能支付
      if (this.aggOrder.balanceOrderInfo && this.aggOrder.balanceOrderInfo.finalBalanceTimeStatus == 0) return;
      this.getShopInfo(this.detailList[0].prodId);
    },
    openReCommendPresent() {
      this.$refs.recommendPresent.completetRecommendTask({
        relateId: this.aggOrder.extId,
        orderId: this.aggOrder.oldOrderId
      });
    },
    handleClickpayAward() {
      let data = {
        orderId: this.payAward.orderId,
        md5Key: this.payAward.md5Key,
        ppId: this.payAward.ppId,
        paId: this.payAward.paId
      };
      utilJs.postMethod(
        `${global.apiurl}activity/payAward/receivePayAward`,
        data,
        res => {
          // 抽奖大转盘活动
          if (res.awardType == 3) {
            let goPath = res.awardInfo.url.match(/#(\S*)/)[1];
            this.$routerGo(this, 'push', {
              path: goPath
            });
            return;
          }
          if (res.awardType == 2) {
            this.$showCjToast({
              text: '领取成功'
            });
            this.initData();
          }
        },
        failes => {
          this.initData();
        }
      );
    },
    //企业团购票券
    goGroupPurchaseTicket() {
      this.$routerGo(this, 'push', { path: '/homePage/groupPurchase/groupPurchaseMyTicket', query: { orderId: this.aggOrder.oldOrderId } });
    },
    clickOpenVipGift() {
      this.$refs.RefVipOrderGift.public_open();
    },
    clickGoShop(item) {
      let prodInfo = this.detailList.length && this.detailList[0];
      //搭配购待支付订单的产品信息在collocationProdInfo
      prodInfo = this.collocationProdInfo || prodInfo;
      let { prodId, prodType } = item;
      let query = {};
      if (prodType == 68 || prodType == 69) {
        //vip拼团
        query.isSales = true;
      }
      prodType = prodType == 201 ? global.ckFrom.mutuaTest : prodType == 15 ? global.ckFrom.circusee : prodType;
      //活动没活动id不跳转
      if (prodType == 7 && (!this.aggOrder.prodEnrollInfo || (this.aggOrder.prodEnrollInfo && !this.aggOrder.prodEnrollInfo.activityId))) {
        return;
      }
      //活动要传活动id
      if (prodType == 7 && this.aggOrder.prodEnrollInfo && this.aggOrder.prodEnrollInfo.activityId) {
        prodId = this.aggOrder.prodEnrollInfo.activityId;
      }
      //问答要传问题id
      if (prodType == 17) {
        prodId = this.aggOrder.questionDetailId;
      }
      //问答退款后不做跳转
      if (prodType == 17 && this.aggOrder.status == -309) {
        return;
      }
      //有价券要用extid，但是搭配购用的是prodid
      if (prodType == 5000 && prodInfo.prodType != global.ckFrom.collocationBuy) {
        prodId = this.aggOrder.extId;
      }
      //服务商不做跳转
      const agentProdTypeArr = [42, 43, 44, 138, 139, 160, 161, 162, 163];
      if (agentProdTypeArr.includes(prodType)) {
        return;
      }

      goDetails(this, prodType, prodId, query);
    },
    //跳转到物流信息详情
    goAddressDetail() {
      if (!this.isShowGoExpressDetail) {
        return;
      }
      this.$routerGo(this, 'push', {
        path: '/mall/shippingAddress/addressList',
        query: { fromOrderDetail: 1, goId: this._mallGodId }
      });
    },
    // 修改地址
    handleClickAddress() {
      this.$routerGo(this, 'push', {
        path: '/mall/mallOrder/orderAddress',
        query: {
          goId: this._mallGodId
        }
      });
    },
    // 跳转到高德地图显示间距
    getLocation() {
      let info = {
        address: this.express.offline.address,
        modName: this.express.offline.modName,
        lat: this.express.offline.lat,
        lng: this.express.offline.lng
      };
      localStorage.setItem('address', JSON.stringify(info));
      this.$routerGo(this, 'push', {
        path: '/distanceAMap'
      });
    },
    //跳转到售后记录
    clickRefundList() {
      this.$routerGo(this, 'push', {
        path: '/member/myRefund/myRefundList',
        query: { goId: this._mallGodId }
      });
    },

    clickCancel() {
      this.$cjConfirm({
        title: '提示',
        message: '确定取消订单?',
        themeColor: this.$getThemeColor(),
        onConfirm: () => {
          this.cancelOrder();
        }
      });
    },
    // 点击确定取消订单
    cancelOrder() {
      let url = this.aggOrder.orderSubType == 200 ? 'goodsOrders/orderHandle' : 'orders/orderCancel';
      let data = {
        status: -2
      };
      this.aggOrder.orderSubType == 200 ? (data.goId = this.aggOrder.oldOrderId) : (data.orderId = this.aggOrder.oldOrderId);
      utilJs.postMethod(`${global.apiurl}${url}`, data, res => {
        this.$showCjToast({
          text: '取消成功'
        });
        this.$nextTick(() => {
          this.$router.go(-1);
        });
      });
    },
    // 获取是否买赠产品
    getIsPresentProd() {
      if (!this.aggOrder) {
        return false;
      }
      if (!this.aggOrder.tags) {
        return false;
      }
      if (!this.aggOrder.tags.length) {
        return false;
      }
      return this.aggOrder.tags.includes(4);
    },
    //获取是否限时购产品
    getIsFlashSales() {
      if (!this.aggOrder) {
        return false;
      }
      if (!this.aggOrder.tags) {
        return false;
      }
      if (!this.aggOrder.tags.length) {
        return false;
      }
      return this.aggOrder.tags.includes(8);
    },
    //获取是否砍价产品
    getIsBargain() {
      if (!this.aggOrder) {
        return false;
      }
      if (!this.aggOrder.tags) {
        return false;
      }
      if (!this.aggOrder.tags.length) {
        return false;
      }
      return this.aggOrder.tags.includes(4096);
    },
    // 点击支付
    clickPay() {
      if (this.hasShoppingGoods) {
        this.clickSubmitOrder();
      } else {
        this.clickGoPay();
      }
    },
    // 知识产品付款
    clickGoPay() {
      //TODO
      // 判断体验版是否到期，到期之后不可购买商品
      if (utilJs.alertShopExpire(this, utilJs.getTimeByDate(this.companyAuth.expireTime))) return true;
      let prodInfo = this.detailList.length && this.detailList[0];
      //搭配购待支付订单的产品信息在collocationProdInfo
      prodInfo = this.collocationProdInfo || prodInfo;
      if (!prodInfo) {
        this.$showCjToast({
          text: '获取产品信息失败'
        });
        return;
      }
      if (!utilJs.isOpenIosGzhPay(prodInfo.prodType)) {
        this.$store.commit('updateShowVitualModal', true);
        return;
      }
      let path = '/homePage/course/coursePay';
      let queryObj = {};
      const VIP_BUY_TYPE_ARRAY = ['1', '2', '3', '4', '22', '23', '27', '28', '68', '69', '73', '74'];
      //vip购买跳转到vip的支付页
      if (VIP_BUY_TYPE_ARRAY.includes(`${prodInfo.prodType}`)) {
        queryObj = {
          prodId: prodInfo.prodId,
          type: prodInfo.prodType,
          orderId: this.aggOrder.oldOrderId
        };
        if (this.getIsBargain()) {
          //VIP砍价活动
          queryObj.attendId = this.aggOrder.extId;
        } else if (this.aggOrder.tags.includes(4194304)) {
          //VIP推荐有礼活动
          queryObj.recRelateId = this.aggOrder.extId;
          queryObj.recType = 3;
        } else if (this.aggOrder.tags.includes(1048576)) {
          //VIP企业团购活动
          queryObj.isFrom = 4;
          queryObj.isFromGroupOrder = true;
          queryObj.quantity = prodInfo.quantity;
        } else {
          //其他VIP购买情况
          queryObj.isFrom = 0;
          queryObj.pId = this.aggOrder.extId || '';
        }
        //买赠vip 产品类型转换成27 买赠vip 28 买赠svip
        if (this.getIsPresentProd()) {
          queryObj.type = prodInfo.prodType == 1 ? 27 : 28;
        }
        //限时购vip 产品类型转换成 68  vip限时购 69 svip限时购
        if (this.getIsFlashSales()) {
          queryObj.type = prodInfo.prodType == 1 ? 68 : 69;
        }
        this.$routerGo(this, 'push', {
          path: '/member/vip/vipBuy',
          query: queryObj
        });
        return;
      }
      //课程购买跳转到课程下单页
      switch (prodInfo.prodType) {
        //视频
        case 110:
          queryObj = {
            cId: prodInfo.prodId,
            extId: -1,
            courseType: 0
          };
          break;
        //音频
        case 111:
          queryObj = {
            cId: prodInfo.prodId,
            extId: -1,
            courseType: 1
          };
          break;
        //图文
        case 112:
          queryObj = {
            cId: prodInfo.prodId,
            extId: -1,
            courseType: 2
          };
          break;
        case 7:
          //活动
          queryObj = {
            cId: -1,
            activityId: this.aggOrder.prodEnrollInfo && this.aggOrder.prodEnrollInfo.activityId,
            extId: prodInfo.prodId,
            selectNum: prodInfo.quantity
          };
          break;
        case 53:
          //约课
          queryObj = {
            cId: -1,
            extId: prodInfo.prodId,
            prodId: prodInfo.prodId
          };
          break;
        case 42:
        case 43:
        case 44:
        case 138:
        case 139:
        case 160:
        case 161:
        case 162:
        case 163:
          //服务商
          queryObj = {
            cId: -1,
            extId: this.aggOrder.extId,
            aaId: prodInfo.prodId
          };
          break;
        case 86: //预约师资
          queryObj = {
            cId: -1,
            extId: this.aggOrder.extId
          };
          break;
        case 15: //提问
        case 17: //问答围观
        case 129: //练习
        case 125: //测评考试
        case 9: //专栏
        case 56: //词典
        case 10: //社群
        case 11: //测评
        case 61: //知识套餐
        case 78: // 训练营
        case 51: //公开课
        case 41: //打卡
        case 180: //直播间
        case 75: //互动测评
        case 115: //小班课
        case 8: //资料
        case 77: //AI.测评
        case 142: //电子书
        case 103: //内容市场
          queryObj = {
            cId: -1,
            extId: prodInfo.prodId
          };
          break;
        case 116: //面授课
          queryObj = {
            cId: -1,
            extId: prodInfo.prodId,
            jwSaleCourseSpecId: this.aggOrder.extId,
            studentId: this.aggOrder.extId1
          };
          break;
        case 5000: //有价券
          queryObj = {
            cId: 0,
            extId: this.aggOrder.extId
          };
          break;
        case 181:
        case 185:
          //圈子
          queryObj = {
            cId: 0,
            extId: prodInfo.prodId
          };
          if (prodInfo.spec) {
            queryObj.circleSpecDateType = prodInfo.spec.type;
            queryObj.circleSpecDateVal = prodInfo.spec.val;
          }
          break;
        case 190:
          //虚拟充值
          queryObj = {
            cId: prodInfo.prodId,
            extId: 0
          };
          break;
        case 200:
          //股东付费抵用券
          queryObj = {
            cId: -1,
            extId: prodInfo.prodId,
            rcdId: this.aggOrder.rcdId || '',
            number: 1
          };
          break;
        case 197:
          //搭配购
          if (this.aggOrder.prodsCollocation.specType == 2) {
            let multipleTmp = {
              name: this.aggOrder.prodsCollocation.specName,
              id: this.aggOrder.extId,
              prods: this.aggOrder.prodsCollocation.subOrder
            };
            localStorage.setItem('collocationProds', JSON.stringify(multipleTmp));
          } else {
            localStorage.setItem('collocationProds', JSON.stringify(this.aggOrder.prodsCollocation.subOrder));
          }
          queryObj = {
            cId: -1,
            extId: prodInfo.prodId,
            comboType: this.aggOrder.prodsCollocation.comboType
          };
          if (this.aggOrder.prodsCollocation.specType == 2) {
            queryObj.isMultiple = 1;
          }
          break;
      }
      //买赠产品型转化
      const PRESENT_PRODTYPE_MAP = {
        110: 25, //买赠课程
        111: 25, //买赠课程
        112: 25, //买赠课程
        9: 26, //赠送专栏
        61: 62, //买赠知识套餐
        142: 145, //赠送电子书
        78: 146 //赠送训练营
      };
      //限时购产品类型转化
      const FLASH_PRODTYPE_MAP = {
        110: 66, //限时购课程
        111: 66, //限时购课程
        112: 66, //限时购课程
        9: 67, //限时购专栏
        61: 70, //限时购知识套餐
        11: 71, //限时购测评
        51: 72, //限时购直播
        41: 8075, //限时购打卡
        78: 8076, //限时购训练营
        10: 8077, //限时购社群
        53: 8078, //限时购约课
        77: 8079, //限时购语音测评
        75: 8080, //限时购交互测评
        142: 8083, //限时购电子书
        115: 8084 //限时购小班课
      };
      queryObj.ckFrom = prodInfo.prodType;
      //买赠
      const isPresent = this.getIsPresentProd();
      const isFlashSales = this.getIsFlashSales();
      //买赠
      if (isPresent) {
        queryObj.ckFrom = PRESENT_PRODTYPE_MAP[prodInfo.prodType] || prodInfo.prodType;
      }
      //限时购 --如果是买赠+限时购，则from的值为买赠
      if (isFlashSales && !isPresent) {
        queryObj.ckFrom = FLASH_PRODTYPE_MAP[prodInfo.prodType] || prodInfo.prodType;
      }
      if (isFlashSales) {
        //面授课特殊处理jwMarketingId为限时购id
        queryObj.pId = prodInfo.prodType == global.ckFrom.edu ? this.aggOrder.jwMarketingId : this.aggOrder.extId;
      }
      //课程类型转成
      if ([110, 111, 112].includes(queryObj.ckFrom)) {
        queryObj.ckFrom = 5;
      }
      queryObj.orderId = this.aggOrder.oldOrderId;
      queryObj.isFromOrder = 'TRUE';
      queryObj.isFromInvite = this.aggOrder.isDeductedByInvitationCard || 0;
      //砍价活动
      if (this.getIsBargain()) {
        queryObj.attendId = this.aggOrder.extId;
      }
      //推荐有礼活动
      if (this.aggOrder.tags == '4194304') {
        queryObj.recRelateId = this.aggOrder.extId;
        queryObj.recType = 3;
      }
      //企业团购
      if ((this.aggOrder.tags & 1048576) == 1048576) {
        queryObj.isGroupPurchase = true;
        queryObj.groupSelectNum = prodInfo.quantity;
        queryObj.groupPurchaseId = this.aggOrder.extId;
      }
      this.$routerGo(this, 'push', {
        path: path,
        query: queryObj
      });
    },
    // 票券信息
    toTickInfo() {
      // 点击查看票券
      this.$routerGo(this, 'push', {
        path: `/activity/myTicket`,
        query: {
          activityId: this.aggOrder.prodEnrollInfo.activityId,
          identCode: this.aggOrder.prodEnrollInfo.identCode,
          asId: 0
        }
      });
    },
    // 活动报名记录
    toMyActivity() {
      this.$routerGo(this, 'push', {
        path: `/member/myActivity/myActivity`
      });
    },
    /** 开票相关---START--- */
    clickShowInvoice() {
      this.showInvoice = true;
      this.$refs.invoiceModal.public_initData();
    },
    clickCloseModal() {
      this.showInvoice = false;
    },
    // 填写开票信息
    setInvoice(data) {
      this.showInvoice = false;
      if (!(data && (data.invoiceName || data.invoiceCode))) return;
      // data.goId = this._mallGodId;
      data.orderNo = this.aggOrder.orderNo;
      utilJs.postMethod(global.apiurl + 'goodsOrders/setInvoice', data, res => {
        this.$showCjToast({
          text: '提交成功',
          type: 'success',
        });
        this.initData();
      });
    },
    /** 开票相关---END--- */
    /** 收货相关---START--- */
    // 收货判断
    clickConfirmReceipt() {
      this.$cjConfirm({
        title: '确认收货',
        message: '',
        clickCloseModal: false, //是否点击透明背景关闭弹窗
        onConfirm: () => {
          this.confirmReceipt();
        }
      });
    },
    // 确认收货
    confirmReceipt() {
      utilJs.postMethod(
        global.apiurl + 'goodsOrders/orderHandle',
        {
          status: 3,
          goId: this._mallGodId
        },
        res => {
          this.$showCjToast({
            text: '已收货',
            type: 'success',
          });
          this.initData();
        }
      );
    },
    /** 收货相关---END--- */
    /** 退款相关---START--- */
    //获取当前退款状态对应的文本
    getRefundStatusText(item) {
      //关闭退款 || 可退款订单 || 还在售后期内 || 预售未付过定金的 || 待付款/未支付尾款/拼团中或者订单状态小于0(支付失败/取消支付等支付未完成情况) || 非尾款未付处于售后中的交易关闭 || 非商城订单不做退款 || 非赠品 || 非兑换订单 || 非视频号来源 || 非积分商城 ||线下付款
      if (
        this.setting.enableApplyRefund != 1 ||
        this.aggOrder.enableRefund != 1 ||
        item.enableAfterSale != 1 ||
        (this.aggOrder.balanceOrderInfo && this.aggOrder.balanceOrderInfo.finalBalanceStatus && this.aggOrder.balanceOrderInfo.finalBalanceStatus != 1) ||
        [1, 103, 105].includes(this.orderStatus) ||
        this.orderStatus == 5 && !(this.aggOrder.balanceOrderInfo && this.aggOrder.balanceOrderInfo.finalBalanceTimeStatus == 2 && this.detailList.some(i => [100, 101, 102, 400].includes(i.afterSaleStatus))) ||
        this.aggOrder.status < 0 ||
        (this.aggOrder.orderSubType == 100 && item.prodType != global.ckFrom.shopping) ||
        PRESENT_SRC_MAP[item.prodSrc] ||
        this.aggOrder.orderType == 2 ||
        this.isVideoChannel ||
        this.getIsIntegralProduct ||
        this.aggOrder.paymentMethod == 4
      ) {
        return '';
      }
      let text = '';
      // 0:无售后 300:用户撤销售后 301:买家超时未处理 401:退货后，商家拒绝退款
      if ([0, 300, 301, 401].includes(item.afterSaleStatus)) {
        text = '申请退款';
      } else if ([100, 101, 102, 400].includes(item.afterSaleStatus)) {
        // 100 买家发起售后 101商家同意售后 102商家同意售后 退货中 400商家拒绝申请
        text = '售后中';
      }
      return text;
    },
    clickRefundType(type) {
      this.$routerGo(this, 'push', {
        path: '/mall/mallOrder/applyRefund',
        query: { godId: this.currentGodId, type: type }
      });
    },
    // 点击退款流程
    goApplyRefund(item) {
      // 退定金流程
      if (this.aggOrder.balanceOrderInfo && !item) {
        item = this.detailList && this.detailList.length > 0 ? this.detailList[0] : null;
        // 完成订单、待收货、多商品且未整个订单且点击商品已发货
        if (this.orderStatus == 4 || this.orderStatus == 3 || (this.orderStatus == 2 && this.detailList && this.express.packageNum > 0 && this.express.isSplitPackage == 1 && item.logiStatus == 2)) {
          this.currentGodId = item.godId;
          this.$refs.ChangeRefundType.public_open();
        } else {
          this.$routerGo(this, 'push', {
            path: '/mall/mallOrder/applyRefund',
            query: { godId: item.godId, type: 1, refundReason: 13 }
          });
        }
        return;
      }
      // afterSaleStatus 0:没有产生售后(无需售后) 100:发起售后（售后中）101:同意售后（售后中）102:同意售后（售后中）其他大于102的表示售后结束
      let godId = item.godId,
        afterSaleStatus = item.afterSaleStatus,
        gorId = item.gorId;
      // 0:无售后 300:用户撤销售后 301:买家超时未处理 400:商家拒绝售后 401:退货后，商家拒绝退款
      if ([0, 300, 301, 401].includes(afterSaleStatus)) {
        if (this.aggOrder.enableRefund == 0) {
          this.$showCjToast({
            text: this.aggOrder.collageData && this.aggOrder.collageData.marketStatus == 1 ? '拼图正在进行中，无法进行售后' : '当前退款商户号和支付的商户号不一致，无法退款',
            type: 'warn',
          });
          return;
        }
        // 完成订单、待收货、多商品且未整个订单且点击商品已发货
        if (this.orderStatus == 4 || this.orderStatus == 3 || (this.orderStatus == 2 && this.detailList && this.express.packageNum > 0 && this.express.isSplitPackage == 1 && item.logiStatus == 2)) {
          this.currentGodId = godId;
          this.$refs.ChangeRefundType.public_open();
        } else {
          this.$routerGo(this, 'push', {
            path: '/mall/mallOrder/applyRefund',
            query: { godId: godId, type: 1, isCanUseGiftCard: this.isCanUseGiftCard && this.giftCardPay > 0 ? 1 : 0 }
          });
        }
      } else if ([100, 101, 102, 400].includes(afterSaleStatus)) {
        this.$routerGo(this, 'push', {
          path: '/mall/mallOrder/orderAfterSales',
          query: { godId: godId, gorId: gorId }
        });
      }
    },
    /** 退款相关---END--- */
    getProdCover(item) {
      let cover = item.prodCover;
      //vip图片封面处理
      if (item.prodType == global.ckFrom.vip) {
        cover = (item.prodCover.coverType == 2 && item.prodCover.coverUrl) || '';
      }
      //svip图片封面处理
      if (item.prodType == global.ckFrom.svip) {
        cover = (item.prodCover.coverType == 2 && item.prodCover.coverUrl) || '';
      }
      return cover;
    },
    // 获取产品类型
    getProdTypeText(item) {
      let text = global.prodMapType[item.prodType];
      let prodsCollocation = this.aggOrder.prodsCollocation;
      //如果是搭配购产品，需要替换成具体套餐类型
      if (item.prodType == global.ckFrom.collocationBuy && prodsCollocation) {
        text = prodsCollocation.comboType == 1 ? '自选套餐' : '固定套餐';
      }
      //交互测评结果文案替换
      if (item.prodType == global.ckFrom.mutuaTestResult) {
        text = '测评报告';
      }
      //测评专题文案替换
      if (item.prodType == global.ckFrom.exam) {
        text = '测评专题';
      }
      //圈子主题文案替换
      if (item.prodType == global.ckFrom.circleTheme) {
        text = '圈子主题';
      }
      //抵用券文案替换
      if (item.prodType == global.ckFrom.shareholderPayVoucher) {
        text = '代金券';
      }
      //问答提问文案替换
      if (item.prodType == global.ckFrom.qa) {
        text = localStorage.getItem('questionCustom') == 1 ? '预约专区' : '问答提问';
      }
      //问答回答文案替换
      if (item.prodType == global.ckFrom.answer) {
        text = localStorage.getItem('questionCustom') == 1 ? '预约专区' : '付费问答';
      }
      //问答回答文案替换
      if (item.prodType == global.ckFrom.circusee) {
        text = localStorage.getItem('questionCustom') == 1 ? '围观预约' : '围观解答';
      }
      //虚拟币自定义文案替换
      if (item.prodType == global.ckFrom.giftCard) {
        text = this._giftCardName;
      }
      return text;
    },
    getProdValidityDate(item) {
      if (!item.spec) {
        return '';
      }
      let type = item.spec.type;
      let number = item.spec.val;
      const typeMap = {
        1: `${number}天`,
        2: `${number}月`,
        3: `${number}年`,
        4: `永久`
      };
      let text = typeMap[type] ? `有效期：${typeMap[type]}` : '';
      return text;
    },
    getIsShowPrice(item) {
      //搭配购主产品，直接显示
      if (item.prodType == global.ckFrom.collocationBuy) {
        return true;
      }
      //不是搭配购产品，直接显示
      if (!this.aggOrder.prodsCollocation) {
        return true;
      }
      //当前不是搭配购产品 && 存在搭配购信息 -- 说明是搭配购的套餐内容，并且开启了不显示单品价格
      if (item.prodType != global.ckFrom.collocationBuy && this.aggOrder.prodsCollocation && this.aggOrder.prodsCollocation.isShowPrice == 0) {
        return false;
      }
      return true;
    },
    clickProtocol(item) {
      this.$routerGo(this, 'push', { path: `/homePage/agent/protocolInfo`, query: { protocolId: item.protocolId } });
    },
    copyText(id) {
      utilJs.copyText(id);
    },
    //优惠信息内容
    getDiscountTypeText(item) {
      if (item.discountType == 1) {
        return `${this.customPointName}抵扣`;
      } else if (item.discountType == 9) {
        return `满减`;
      }
      return item.discountTypeText;
    },
    // 头部状态类型 --这块我抄的admin后台的
    getHeaderStatusType() {
      let statusType = 1;
      // 数据没返回先显示待付款
      if (!this.aggOrder) {
        return statusType;
      }
      if (this.aggOrder.status === 0) {
        // 待支付
        statusType = 1;
      } else if (this.aggOrder.status == -100) {
        // 支付失败
        statusType = 101;
      } else if ([-301, -302].includes(this.aggOrder.status)) {
        // 待支付，超时关闭
        statusType = 102;
      } else if (this.aggOrder.status == 100) {
        // 已支付
        statusType = 4;
      } else if (this.isPresale && this.aggOrder.status == 200) {
        // 预售订单，超出预售付尾款时间，待付尾款
        statusType = this.aggOrder.balanceOrderInfo.finalBalanceTimeStatus == 2 ? 112 : 105;
      } else if (this.isPresale && this.aggOrder.status == -304) {
        // 预售订单，未支付尾款，关闭
        statusType = 106;
      } else if (this.aggOrder.status == -305) {
        // 部分退款，约课席位费部分退
        // 虚拟币支付的退款为不显示副文案的交易关闭
        statusType = this.isVirtualCoin ? 110 : 7;
      } else if (this.aggOrder.status == -300) {
        // 全额退款
        // 虚拟币支付的退款为不显示副文案的交易关闭
        statusType = this.isVirtualCoin ? 110 : 8;
      } else if (this.aggOrder.status == -303) {
        // 商家取消订单
        statusType = 107;
      } else if (this.aggOrder.status == -102 && this.aggOrder.marketType != 32) {
        // 买家取消订单(非兑换券兑换获得的)
        statusType = 108;
      } else if (this.aggOrder.status == -306) {
        // 超库存退款
        statusType = 109;
      } else if (this.aggOrder.status == -307 || (this.aggOrder.status == -308 && this.detailList.find(item => item.prodType == global.ckFrom.seatFee || item.prodType == global.ckFrom.reReservation))) {
        // -307取消购买 -308/约课退席位费/约课席位费全额退，
        // 110作为没有副文案的“交易关闭”
        statusType = 110;
      } else if (this.aggOrder.status == -309) {
        //-309活动签到退款/问答超时退款
        statusType = 111;
      } else if (this.aggOrder.status == -308 && this.detailList.find(item => item.prodType == global.ckFrom.booking)) {
        // -308取消预约
        statusType = 113;
      } else if (this.aggOrder.status == -102 && this.aggOrder.marketType == 32) {
        // 买家取消订单(兑换券兑换获得的)
        statusType = 114;
      }
      // 是否拼团失败 拼团状态 —— 2拼团中、3拼团失败； 拼团失败类型 —— -1人数不足、-2票不足、-3面授课库存不足、-4报名人数已满
      let isCollageFail = this.aggOrder.isCollage == 1 && this.aggOrder.collageData && ([2, 3].includes(this.aggOrder.collageData.groupStatus) || [-1, -2, -3, -4].includes(this.aggOrder.collageData.collageType));
      if (isCollageFail) {
        // 拼团订单 —— 支付失败（对应101）；collageStatus = 2：进行中（对应103）；3：失败（对应104）
        statusType = this.aggOrder.status == -100 ? 101 : this.aggOrder.collageData.groupStatus == 2 ? 103 : 104;
        // 商城拼团，因流程不同，超库存退款依旧处于拼园中，需要特殊处理覆盖
        if (this.aggOrder.orderSubType == 200 && this.aggOrder.status == -306) {
          statusType = 109
        }
      }
      // 存在实物商品
      if (this.hasShoppingGoods) {
        // 已支付；非拼团订单（防止覆盖）
        // 取决于订单总状态（4转3，0转1）
        if (this.aggOrder.status == 100 && !isCollageFail) {
          if (this.aggOrder.logiStatus == 1) {
            // 待发货
            statusType = 2;
          } else if (this.aggOrder.logiStatus == 2) {
            // 已发货
            statusType = 3;
          } else {
            // 已完成
            statusType = 4;
          }
        }
        // 商品中均不存在售后时，再来算整个订单的状态
        if (!this.detailList.some(item => item.afterSaleStatus != 0)) {
          if (this.aggOrder.status == -305 && this.moneyData.actualReceivedAmount != this.aggOrder.refundMoney) {
            // 部分退款
            statusType = 7;
          }
          if (this.aggOrder.status == -300) {
            // 全额退款
            statusType = 8;
          }
        }
      }
      console.log('statusType--', statusType);
      return statusType;
    },
    initData() {
      clearInterval(this._timeControl);
      this._timeControl = null;
      this.isShowPay = false;
      this.showPassword = false;
      this.payMoney = 0;
      this._giftCardName = '';
      isWechatPaying = false;
      countDownTime = '';
      automaticCancelTime = 0; //未支付自动关闭时间
      automaticRecipientTime = 0; //未收获自动收获时间
      currentDate = 0; //系统时间
      isTest = false; //判断是否时测试平台
      this.getOrderDetail();
      this.getGiftCardInfo();
    },
    //重置搭配购产品列表数据
    resetCollocationProdList(list) {
      let collocation = this.aggOrder.prodsCollocation;
      let collocationProdInfo = list && list.length && list[0];
      collocationProdInfo.comboType = collocation.comboType;
      collocationProdInfo.specName = collocation.specName;
      collocationProdInfo.specType = collocation.specType;
      this.collocationProdInfo = collocationProdInfo;
      let collocationArr = [];
      //固定套餐
      if (collocation.comboType == 2) {
        collocationArr = collocation.subOrder;
      } else {
        //自选套餐
        for (let item of collocation.subOrder) {
          for (let cItem of item.prods) {
            collocationArr.push(cItem);
          }
        }
      }
      let newDetailList = [];
      const courseTypeMap = {
        '5-0': 110,
        '5-1': 111,
        '5-2': 112
      };
      let collocationTotalPrice = 0;
      for (let item of collocationArr) {
        //课程类型需要转换一下
        let prodType = item.prodType == 5 ? courseTypeMap[`${item.prodType}-${item.courseType}`] : item.prodType;
        let info = {
          prodType: prodType,
          prodName: item.prodName,
          prodId: item.prodId,
          prodCover: item.cover,
          prodPrice: item.price,
          quantity: item.prodNum
        };
        newDetailList.push(info);
        collocationTotalPrice += item.price * item.prodNum;
      }
      this.detailList = newDetailList;
      //搭配购总价调整
      let originalTotalPrice = this.moneyData.detailTotalPayMoney;
      this.moneyData.detailTotalPayMoney = collocationTotalPrice.toFixed(2);
      //搭配购优惠金额增加
      let info = {
        discountType: 25,
        discountTypeText: '优惠金额',
        deductMoney: (collocationTotalPrice - originalTotalPrice).toFixed(2)
      };
      this.moneyData.discountCounts.unshift(info);

    },
    getGiftCardInfo() {
      utilJs.getGiftCardInfo().then(res => {
        this._giftCardName = res.name || '虚拟币';
      });
    },
    getOrderDetail() {
      // 为了兼容旧的页面跳转过来，只会带orderId或者goId，所以这边传了三个参数，orderNo 新订单 orderId 旧知识产品订单 goId 旧商城订单
      utilJs.getMethod(`${global.apiurl}aggOrder/getAggOrderDetail?orderNo=${this._orderNo}&orderId=${this._orderId}&goId=${this._goId}`, res => {
        this.aggOrder = res.aggOrder;
        this.moneyData = res.moneyData;
        this.payMoney = this.moneyData.actualReceivedAmount * 1;
        this.aggOrderDeliver = res.aggOrderDeliver;
        this.protocolInfo = res.protocolInfo || [];
        this.express = res.express;
        this.payAward = res.payAward;
        this.vipOrderGiftList = res.vipOrderGiftList || [];
        this.setting = res.setting;
        this.invoice = res.invoice;
        this.userInfo = res.userInfo;
        this.payConf = res.payConf;
        //存在搭配购信息 && (代付款订单 || 超时未支付订单)   需要重置产品列表为搭配购的产品内容
        let needResetCollocationStatus = this.aggOrder.status == 0 || this.aggOrder.status == -302 || this.aggOrder.status == -301;
        if (this.aggOrder.prodsCollocation && needResetCollocationStatus) {
          this.resetCollocationProdList(res.detailList);
        } else {
          this.detailList = res.detailList || [];
        }
        //赠送了实体，需要获取实体订单的goid用来收货和查看物流信息
        let mallGodIdItem = this.detailList.find(i => i.goId);
        if (this.aggOrder.haveGiftMallProd == 1 && mallGodIdItem) {
          this._mallGodId = mallGodIdItem.goId;
        }
        //商城的订单id，统一重新赋值
        this._mallGodId = this._mallGodId || this.aggOrder.oldOrderId;
        currentDate = this.aggOrder.serverTime ? this.aggOrder.serverTime : 0;
        automaticCancelTime = this.aggOrder.automaticCancelTime ? this.aggOrder.automaticCancelTime : 0;
        automaticRecipientTime = this.aggOrder.automaticRecipientTime ? this.aggOrder.automaticRecipientTime : 0;
        // 处理倒计时
        this.$nextTick(() => {
          this.setCutDown();
        });
      });
    },
    //分享
    wechatShare: function() {
      let title = '我的订单';
      let shareUrl = window.location.href.split('#')[0] + '#/member/myOrder/allOrderList?refereeId=' + localStorage.getItem('userId');
      utilJs.wechatConfig(shareUrl, title, '', '', function() {});
    },
    //手机端分享
    appShare: function() {
      let title = '我的订单';
      let shareUrl = window.location.href.split('#')[0] + '#/member/myOrder/allOrderList?refereeId=' + localStorage.getItem('userId');
      utilJs.appShareTrue(title, '', shareUrl, '');
    }
  }
};
</script>
<style scoped>
.bgTop {
  background-image: url('https://ck-bkt-knowledge-payment.oss-cn-hangzhou.aliyuncs.com/admin/material/9_material_admin/image/assets/i/orderBg.png');
  width: 100%;
  background-position: top center;
  background-repeat: no-repeat;
}
.order-fotter {
  width: 100%;
  max-width: 16rem;
  border: 1px solid rgba(242, 242, 242, 1);
  box-shadow: 0px -6px 3px 0px rgba(132, 132, 132, 0.03);
  position: fixed;
  margin: 0 auto;
  left: 0;
  right: 0;
  bottom: 0;
}
.masker-content {
  background-color: #fff;
  max-height: 7.85rem;
  height: 7.85rem;
  width: 100%;
}
.masker-content1 {
  background-color: #fff;
  max-height: 9rem;
  height: 9rem;
  width: 100%;
}
.pl180 {
  padding-left: 4.5rem;
}
</style>
